<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Cadastrando</h2>

            <p:panel styleClass="container_24 clearfix " style="background: none; border: none;"> 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000"/>
                    <p class="subtitle"> Dados Gerais</p>
                    <p:outputLabel value="Nome: " styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateExecutor.executor.name}"  styleClass="grid_20"/>
                    
                    <div class="clear"/>
                    
                    <p:outputLabel value="OAB: " styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateExecutor.executor.oab}" styleClass="grid_7"/>
                    
                    <p:outputLabel value="E-mail: " styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateExecutor.executor.email}" styleClass="grid_10"/>

                    <div class="clear"/>
                    <p:outputLabel value="Função:" styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateExecutor.executor.function}" styleClass="grid_20"/>

                    <div class="clear"/>
                    <p:outputLabel for="organ" value="Orgão:" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:autoComplete  value="#{managerCreateExecutor.organ}" completeMethod="#{managerCreateOrgan.autocomplete}"   
                                         var="organ" id="organ" 
                                         itemLabel="#{organ.name}" itemValue="#{organ}" converter="organConverter" 
                                         forceSelection="true" converterMessage="Erro, verifique a cidade"
                                         minQueryLength="3" maxResults="10" dropdown="true"> 
                        </p:autoComplete>
                    </div>
                    <div class="clear"/>

                    <p class="subtitle">Endereço</p>
                    
                        <p:outputLabel value="Rua: "  styleClass="grid_3"/>
                        <p:inputText value="#{managerCreateExecutor.address.street}"  styleClass="grid_20"/>
                        <div class="clear"/>
                        <p:outputLabel value="Bairro: "  styleClass="grid_3"/>
                        <p:inputText value="#{managerCreateExecutor.address.district}" styleClass="grid_7"/>
                        <p:outputLabel value="Número: "  styleClass="grid_3"/>
                        <p:inputText value="#{managerCreateExecutor.address.num}" styleClass="grid_10"/>
                        <div class="clear"/>
                        <p:outputLabel value="CEP: "  styleClass="grid_3"/>
                        <p:inputMask mask="99.999-999" value="#{managerCreateExecutor.address.cep}" styleClass="grid_7"/>
                        <p:outputLabel  value="Cidade: "   styleClass="grid_3" />
                        <div class="grid_10">
                        <p:autoComplete id="cidadeEstado" value="#{managerCreateExecutor.address.city}" completeMethod="#{managerCreateAddress.completeCity}"   
                                        var="city"  required="true" requiredMessage="o campo cidade deve ser preenchido"
                                        itemLabel="#{city.name} #{city.states.sgl}" itemValue="#{city}" converter="cityConverter" forceSelection="true" converterMessage="Erro, verifique a cidade" minQueryLength="3" maxResults="10" dropdown="true"> 
                        </p:autoComplete>
                        </div>
                        <div class="clear"/>
                        <p:outputLabel value="Fone Fixo: " styleClass="grid_3"/>
                        <p:inputMask mask="99-9999-9999" value="#{managerCreateExecutor.address.phone}" styleClass="grid_7"/>
                        <p:outputLabel value="Fone Móvel: "  styleClass="grid_3"/>
                        <p:inputMask mask="99-9999-9999"  value="#{managerCreateExecutor.address.cellular}" styleClass="grid_10"/>

                        <div class="clear"/>
                    <p class="subtitle">Login</p>
                        <div class="clear"/>
                        <p:outputLabel value="Login: " styleClass="grid_3"/>
                        <p:inputText value="#{managerCreateExecutor.executor.login}" styleClass="grid_7"/>
                        <div class="clear"/>
                        <p:outputLabel value="Senha: " styleClass="grid_3"/>
                        <p:password feedback="true" value="#{managerCreateExecutor.executor.password}" styleClass="grid_7"/>
                        <div class="clear"/>
                        <p:outputLabel value="Confirme a Senha: " styleClass="grid_3"/>
                        <p:password id="confirma" feedback="true" value="#{managerCreateExecutor.confirma}" styleClass="grid_7"/>

                    <div class="clear"/>
                    <div class="buttonAction">

                        <p:commandButton value="Salvar" icon="ui-icon-disk" actionListener="#{managerCreateExecutor.save()}" 
                                         update="msg, @form" styleClass="ui-priority-primary"/>
                        <p:commandButton value="Cancelar" icon="ui-icon-close"  actionListener="#{managerRedirect.redirect('viewExecutor.xhtml')}"
                                         immediate="true"/>

                    </div>
                </h:form>
            </p:panel> 
        </ui:define>
    </ui:composition>
</html>


